import {PureComponent} from "react";
import WithRouter from "../../hoc/withRouter";

class HomeSong extends PureComponent {
    constructor(props) {
        super(props);
        this.state = {
            songList: [
                {id: 111, title: '民谣'},
                {id: 112, title: '流行'},
                {id: 113, title: '爵士'},
            ]
        }
    }

    render() {
        const {songList} = this.state;
        const {router: {navigate}} = this.props;
        return (
            <div>
                <h2>首页歌单</h2>
                <ul>
                    {
                        songList.map(item =>
                            <li
                                onClick={() => navigate(`/detail/${item.id}`)}
                                key={item.id}
                            >
                                {item.title}
                            </li>)
                    }
                </ul>
            </div>
        )
    }
}

export default WithRouter(HomeSong)